const app = getApp();
const log =require('../../log.js');
const util=require('../../util.js');
const tabService = require("../../libs/tabService");
Page({

    /**
     * 页面的初始数据
     */
    data: {
        array: ['临沂', '济宁', '菏泽', '枣庄'],
        arrays:[
            {name: '贷款', value: '贷款', checked: 'true'},
            {name: '全款', value: '全款'},

        ]
    
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        var id = options.id;
        console.log(id);
        if(/^\d+$/.test(id)){
            this.setData({
                id:id
            })
            this.getConfigById(id);
        }else{
            console.log('id='+id);
        }
        let that = this ;
        let d =   app.globalData;  
        that.setData({
            platform:d.platform,    
           // userInfo:userInfo,
             width:d.windowWidth,
            height:d.windowHeight,
            statusBarHeight:d.statusBarHeight,
            navHeight:d.navHeight,
            marginTop:d.navTitleTop,
            domain:d.domain,
            uploadUrl:d.uploadUrl
          })
    },

    goBack:function(){
        wx.navigateBack();
      },
      goIndex:function(){
        wx.reLaunch({
          url: '../index/index',
        })
      },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {

    },
    getConfigById(id){
        let that = this;
        var userInfo =  wx.getStorageSync('userInfo');
        var data = [];
        data['user_id']= userInfo.id;
        data['id'] = id;
        var url = 'clear/getConfigById';

      app.request(url,data,'get').then(res=>{ 
        console.log('customer getIndex'); 
         console.log(res);
     
         //this.initChart(res.pie);
         that.setData({
             
             'truck':res.truck,
             'favor':res.favor,
            
             
         });

       //  that.wxUpdate(); //that.wxLogIn();  
      })

      },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})